import { request } from "../request"

/** 默认问卷code */
const defaultExamCode = "exam001";

/** 题目类型 */
export const QuestionType = {
    DANXT: '单选',
    DUOXT: '多选',
    WDT: '问答'
}

/** 获取我是否回答过问卷 */
export const getCheckAnswered = (params) => {
    return request({
        url: '/system/examAnswer/checkAnswered',
        data: { examCode: defaultExamCode },
        method: "GET",
    })
}

/** 获取问卷列表（详情列表） */
export const getQuestionnaireListReq = (params) => {
    return request({
        url: '/system/exam/list',
        data: { examCode: defaultExamCode, status: 0 },
        method: "GET",
    })
}

/** 获取问卷题目 */
export const getExamQuestions = (aeId) => {
    return request({
        url: `/system/exam/${aeId}`,
        method: "GET",
    })
}

/** 提交问卷 */
export const submitAnswer = (params) => {
    return request({
        url: '/system/examAnswer/submitAnswer',
        data: params,
        method: "POST",
    })
}

/** 获取答题记录 params 商家获取列表：userGroup=true  用户答题详情：userId=用户id */
export const getExamAnswerList = (params) => {
    return request({
        url: '/system/examAnswer/list',
        data: params,
        method: "GET",
    })
}
